{-# LANGUAGE OverloadedLists #-}

module Main where

import Data.Curve.Weierstrass (Point (A), mul')
import Data.Group (pow)
import Data.Pairing.BN254 (BN254, G1, G2, pairing)

p :: G1 BN254
p =
  A
    1368015179489954701390400359078579693043519447331113978918064868415326638035
    9918110051302171585080402603319702774565515993150576347155970296011118125764

q :: G2 BN254
q =
  A
    [ 2725019753478801796453339367788033689375851816420509565303521482350756874229,
      7273165102799931111715871471550377909735733521218303035754523677688038059653
    ]
    [ 2512659008974376214222774206987427162027254181373325676825515531566330959255,
      957874124722006818841961785324909313781880061366718538693995380805373202866
    ]

main :: IO ()
main = do
  putStrLn "e(P, Q):"
  print (pairing p q)
  putStrLn "e(P, Q) is bilinear:"
  print $ pairing (mul' p a) (mul' q b) == pow (pairing p q) (a * b)
  where
    a = 2 :: Int
    b = 3 :: Int
